package com.qf.web.view;

import com.qf.pojo.Emp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author 千锋教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
@WebServlet("/showEmpDetails")
public class ShowEmpDetailsServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        Emp  emp = (Emp) req.getAttribute("emp");
        PrintWriter writer = resp.getWriter();
        writer.println("<html>");
        writer.println("<head>");
        writer.println("<title>员工列表</title>");
        writer.println("</head>");
        writer.println("<body>");
        writer.println("<form action='updateEmp' method='post'>");
        writer.println("<input type='hidden' name='id' value='"+emp.getId()+"'><br/>");
        writer.println("姓名：<input type='text' name='name' value='"+emp.getName()+"'><br/>");
        writer.println("工资:<input type='text' name='salary' value='"+emp.getSalary()+"'><br/>");
        writer.println("年龄:<input type='text' name='age' value='"+emp.getAge()+"'><br/>");
        writer.println("<input type='submit' value='修改'><br/>");
        writer.println("</form>");


        writer.println("</body>");
    }
}
